home *** CD-ROM | disk | FTP | other *** search
/ Brick Industry Associati…on Brick Construction 2.0 / Brick Industry Association - Tech Notes on Brick Construction 2.0.iso / msie5 / HELPCONT.CAB / iesupp.chm / shared.js < prev   
Text File  |  2000-06-06  |  42KB  |  1,060 lines

  1. // Filename: shared.js in IEIEShared.chm
  2. // Version post beta 3 (7)
  3. // version 07.01.99
  4.  
  5. //************************************************ EVENT HANDLING ********************************************
  6. //*******************************************************************************************************************
  7. //  re-directs to the proper event-driven functions.
  8.  
  9. window.onload= loadPage;
  10. document.onclick= onclickTriage;
  11. document.onmouseover= gettingHot;
  12. document.onmouseout= gettingCold;
  13. window.onunload=saveChecklistState;
  14. window.onresize= resizeDiv;
  15.  
  16. //window.onbeforeprint= set_to_print;
  17. //window.onafterprint= reset_form;
  18. //********************************************  USER-DEFINED GLOBAL VARIABLES  ************************************
  19. //********************************************************************************************************************
  20. //  The images listed below can all be changed by the user.
  21.  
  22. var sPreviousTip= "Previous topic";
  23. var sNextTip= "Next topic";
  24. var sExpandTip= "Expand/collapse";
  25. var sPopupTip= "View definition";
  26. var sShortcutTip= "";
  27.  
  28. var moniker= "ms-its:";                                         // moniker= ""; for flat files
  29. var sSharedCHM= moniker+"IEShared.chm::/";
  30.  
  31. var closed = sSharedCHM + "plusCold.gif";                //image used for collapsed item in callExpand()
  32. var closedHot = sSharedCHM + "plusHot.gif";            //hot image used for collapsed item in callExpand()
  33. var expand = sSharedCHM + "minusCold.gif";            //image used for expanded item in callExpand()
  34. var expandHot = sSharedCHM + "minusHot.gif";        //hot image used for expanded item in callExpand()
  35.  
  36. var previousCold= sSharedCHM + "previousCold.gif";
  37. var previousHot= sSharedCHM + "previousHot.gif"; 
  38. var nextCold= sSharedCHM + "nextCold.gif";
  39. var nextHot= sSharedCHM + "nextHot.gif"; 
  40.  
  41. var shortcutCold= sSharedCHM + "shortcutCold.gif";
  42. var shortcutHot= sSharedCHM + "shortcutHot.gif";
  43.  
  44. var popupCold= sSharedCHM + "popupCold.gif";
  45. var popupHot= sSharedCHM + "popupHot.gif";
  46.  
  47. var emptyImg= sSharedCHM + "empty.gif";        //image used for empty expand
  48. var noteImg= sSharedCHM + "note.gif";            //image used for notes
  49. var tipImg= sSharedCHM + "tip.gif";            //image used for tips
  50. var warningImg= sSharedCHM + "warning.gif";        //image used for warnings
  51. var cautionImg= sSharedCHM + "caution.gif";        //image used for cautions
  52. var importantImg= sSharedCHM + "important.gif";        //image used for important notice
  53. var relTopicsImg= sSharedCHM + "rel_top.gif";        //image used for important notice
  54.  
  55. var branchImg= sSharedCHM + "elle.gif";
  56. var branchImg_RTL= sSharedCHM + "elle_rtl.gif";
  57.  
  58.  
  59. //********************************************  GLOBAL VARIABLES  ******************************************
  60. //********************************************************************************************************
  61.  
  62. var printing = "FALSE";
  63. var single = "FALSE";
  64. var scroller = "FALSE";
  65. var isRTL= (document.dir=="rtl");
  66. var imgStyleRTL= ""; 
  67.       if (isRTL) imgStyleRTL=" style='filter:flipH' ";
  68.  
  69. var sActX_TDC= "CLASSID='CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83'";        //Tabular Data Control  for  reusable text data
  70. var sSharedReusableTextFile= sSharedCHM + "shared.txt";                                        // common reusable text file
  71. var sSharedReusableTextFileRecord= "para";                                                        //reusable text record
  72.  
  73. var numbers= /\d/g;                //javascript regular expression
  74. var spaces= /\s/g;                //javascript regular expression
  75. var semicolon= /;/g;            //javascript regular expression
  76.  
  77. var isIE5= (navigator.appVersion.indexOf("MSIE 5")>0) || (navigator.appVersion.indexOf("MSIE")>0 && parseInt(navigator.appVersion)> 4);
  78. var isPersistent= false;
  79.  
  80.  
  81. //********************************************  INITIALIZATION  *************************************************
  82. //******************************************************************************************************************
  83.  
  84. //*** loadPage **********************************************************************************************
  85. //  Adds the default image tags and re-usable text to the HTML page.
  86.  
  87. function loadPage(){
  88. isPersistent= (document.all.item("checklist")!=null) && (isIE5);
  89.  
  90.   setPreviousNext();
  91.   resizeDiv();
  92.   if (isPersistent) getChecklistState();
  93.   addReusableText();
  94.   insertImages();
  95. }
  96.  
  97. //****** setPreviousNext  ************************************************************************ ********************************************************************************************* 
  98. // insert previous/next navbar
  99. // called by: <div id="nav">@@HTMLsequenceFile.txt or .lst@@</div>
  100.  
  101. function setPreviousNext(){
  102.  
  103.  
  104.   var oNav = document.all.item("nav");
  105.         if (oNav == null ) return;
  106.   
  107.   var sPreviousALT= sPreviousTip;
  108.   var sNextALT= sNextTip;
  109.   var sHTMLfile= oNav.innerHTML;
  110.  
  111.   var imgPrev= "<IMG SRC='"+previousCold+"' BORDER=0 ALT='"+ sPreviousALT +"' ALIGN='top' "+ imgStyleRTL +">";
  112.   var imgNext= "<IMG SRC='"+nextCold+"' BORDER=0 ALT='"+ sNextALT  + "' ALIGN='top' "+ imgStyleRTL +">";
  113.   
  114.   var previousNextObject= "<OBJECT ID='HTMlist' WIDTH=100 HEIGHT=51 " + sActX_TDC +"><param name='DataURL' value='"
  115.         +sHTMLfile +"'><param name='UseHeader' value=True></OBJECT>";
  116.       
  117.         oNav.innerHTML= "<TABLE WIDTH='100%' STYLE='margin-top:0;' cellspacing=0>"
  118.         + "<TR><TD style='text-align=left; background-color:transparent'><A ID='previousLink' HREF='#' REL='previous' CLASS='navbar'>"
  119.         +imgPrev + "</A></TD><TD width='100%' align='center'></td><TD style='text-align=right; background-color:transparent'><A ID='nextLink' HREF='#' REL='next' CLASS='navbar'>"
  120.         +imgNext+ "</A></TD></TR></TABLE>";
  121.                     
  122.       document.body.innerHTML= document.body.innerHTML +  previousNextObject;
  123.       findPageSeq();
  124.       if (printing == "TRUE") return;
  125.       var  thisLoc= document.location.href +"#";
  126.  
  127.       if (previousLink.href== thisLoc) previousLink.style.display="none";
  128.       else  previousLink.style.display="block";
  129.  
  130.       if (nextLink.href== thisLoc) nextLink.style.display="none";
  131.       else  nextLink.style.display="block";
  132.       
  133. }
  134.  
  135. //****** findPageSeq *********************************************************************************************
  136. // finds this page in the "html sequence list" file (filename.lst) and determines the previous & next pages from the list
  137. // the list is created from a tool named "chumper"
  138.  
  139. function findPageSeq() {
  140.  
  141. var rs= HTMlist.recordset;
  142. var thisLoc= document.location.href;
  143. var iLoc= thisLoc.lastIndexOf("/");
  144.  
  145.     if (iLoc > 0) thisLoc= thisLoc.substring(iLoc+1, thisLoc.length);
  146.     
  147.     
  148.     if (nav.style == "[object]") {
  149.                 nav.style.visibility="hidden";
  150.                 printing = "FALSE";
  151.                 }
  152.         else
  153.             {
  154.                 printing = "TRUE";
  155.                 return;
  156.             }
  157.     
  158.        
  159.     rs.moveFirst();
  160.        
  161.     while (!rs.EOF) {
  162.           if (thisLoc == rs.fields("HTMfiles").value){
  163.               nav.style.visibility="visible"; 
  164.                 rs.MoveNext();
  165.               break;
  166.           }
  167.           previousLink.href=rs.fields("HTMfiles").value;      
  168.           rs.moveNext();
  169.      }
  170.                 
  171.       if (!rs.EOF) nextLink.href=rs.fields("HTMfiles").value;
  172. }
  173.  
  174.  
  175. //******Re-usable text ********************************************************************************************* 
  176. // Inserts the Tabular Data Control (TDC) object at the end of the page 
  177. // Inserts "re-usable text" from the txt file at: <span id="@@CHM_name@@@@index#@@" class="reuse"></span>
  178. // e.g.<span id="printing4" class="reuse"></span> for record#4 in the printing.txt in printing.chm.
  179.  
  180. function addReusableText(){
  181.  
  182. var IESharedAdded= false;                    // make sure the object is only added once
  183. var CHMspecificAdded= false;                // make sure the object is only added once
  184. var coll = document.all.tags("SPAN");
  185. var sIndex,sRecord,sFile,sFileID,dataBindingObject;
  186.  
  187. // TDC object for IEShared.chm
  188. var coreObject= "WIDTH=100 HEIGHT=51 "+sActX_TDC+"><param name='UseHeader' value=True><param name='FieldDelim' value='~'><param name='sort' value='INDEX'>";
  189. var shareTextObject = "<OBJECT ID='IESharedText' " + coreObject + "<param name='DataURL' value='"+sSharedReusableTextFile+"'></OBJECT>";
  190.  
  191.     for (var i=0; i< coll.length; i++)                                   
  192.